home *** CD-ROM | disk | FTP | other *** search
-
- regc(2, "COMBINED_XFORM")
- regc(6, "MODEL_XFORM")
-
- regc(12, "FOG_PARAMS")
-
- regc(13, "CAMERA_POS_MS")
- regcn(14, "DIRECTIONAL_DIR_MS", 0)
-
- regc(20, "TEXTURE2_XFORM")
-
- regc4f(30, 0.0, 0.0, 0.0, %sunvisibility)
- // ------------ c40 - c60 reserved
- !include("vs_spot_consts.inc")
-
- vshader("
-
- #define point v0
- #define normal v1
- #define tangent v2
- #define tcoord v3
-
- #define fogp c12
- #define cpos c13
- #define ldir c14
-
- vs_1_1
-
- #include <cardef.h>
- #include <fog.inc>
-
- def c0, SPECULARPOW, 0, 0, 0
-
- dcl_position point
- dcl_normal normal
- dcl_tangent tangent
- dcl_texcoord tcoord
-
- ; output position
- m4x4 oPos, point, c2
-
- ; E in model space
- add r2, cpos, -point
- ; normalize E
- dp3 r2.w, r2, r2
- rsq r2.w, r2.w
- mul r2.xyz, r2, r2.w
-
- ; reflect E
- dp3 r5.w, r2, normal
- add r6.w, r5.w, r5.w
- mad r6.xyz, normal, r6.w, -r2 // dot(E, N)*2 *N - E
-
- ; output cubemap
- m3x3 oT3, -r6, c24
-
- dp3 r4.x, normal, ldir ; diffuse N*L
- dp3 r4.y, ldir, r6 ; specular L*R
- mov r4.w, c0.x ; specular pow
- lit r3, r4
-
- ; output diffuse
- mov oD0.w, r3.y // sun
- ; output specular
- mul oD1, r3.z, c30.w //sunvisibility
-
- ;------------------------------------------
- // spot lights
- // used r0 - r2
- #if VS_SPOTLIGHTS
- #include <vs_spot_func.inc>
- #endif
- ;----------------------------
- ; output texcoords
- mov oT0, tcoord // color
- mov oT1, tcoord // dirt
-
- ; terrain lightmap texgen (from model space)
- dp4 oT2.x, point, c20
- dp4 oT2.y, point, c21
-
- ; calc fog
- dp4 r0.x, point, c4
- FOG(r0.x, fogp, r10)
- ")
-
-